home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 3 / BBS in a box - Trilogy III.iso / Files / Prog / B-C / C++ FAQ Reference 1.0 / C++ FAQ Reference 1.0.rsrc / TEXT_1431.txt < prev    next >
Encoding:
Text File  |  1993-06-30  |  554 b   |  6 lines

  1. Usually your subobjects should actually be 'contained' in the aggregate class (but not always; 'wrapper' objects are a good example of where you want a a ptr/ref; also the N-to-1-uses-a relationship needs something like a ptr/ref).
  2.  
  3. There are three reasons why fully contained subobjects have better performance than ptrs to freestore allocated subobjects:
  4.     * extra layer to indirection every time you need to access subobject
  5.     * extra freestore allocations ('new' in ctor, 'delete' in dtor)
  6.     * extra dynamic binding (reason given later in this question)